﻿CREATE Trigger t_CreditInfo_Update
On dbo.t_CreditInfo
For Update
As

If Update (HumanReadable)
BEGIN
	
	--DECLARE @HR varchar(8000)
	--SELECT @HR = HumanReadable FROM t_CreditInfo WHERE ApplicantID IN (SELECT ApplicantID FROM inserted)
	--EXEC sh_Debug_Put 'HR:$0',@HR
	
	UPDATE t_CreditInfo
	SET DatePulled = getdate(),
			Pulled = dbo.IsPulledEx(HumanReadable)
	WHERE BorrowerID IN (SELECT BorrowerID FROM inserted)

	DELETE FROM t_TradeReferences WHERE BorrowerID IN (SELECT BorrowerID FROM inserted)
END
